//File:vip弹窗
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xvideos/assets_tool/app_colors.dart';
import 'package:xvideos/hj_page/pre_sale/pre_sale_page.dart';
import 'package:xvideos/hj_utils/widget_utils.dart';
import 'package:xvideos/routers/jump_router.dart';

class VipDialog extends StatelessWidget {
  final bool? presale; //是否是预售期间vip弹窗
  const VipDialog({Key? key, this.presale});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Material(
        color: Colors.transparent,
        child: presale == true ? _buildPresaleContent() : _buildNormalContent(),
      ),
    );
  }

  _buildPresaleContent() {
    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 32),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(12),
        gradient: LinearGradient(
          colors: [
            Color(0xff141414),
            Colors.black,
          ],
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter,
        ),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          22.sizeBoxH,
          Text(
            "温馨提示",
            style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500, color: Colors.white),
          ),
          18.sizeBoxH,
          Container(
            height: 0.5,
            color: Colors.white.withOpacity(0.1),
          ),
          18.sizeBoxH,
          Padding(
            padding: EdgeInsets.symmetric(horizontal: 18),
            child: Text(
              '开通限时预售 全站视频免费观看\n查看更多会员特权',
              style: TextStyle(fontSize: 16, height: 2.0, color: Colors.white),
              textAlign: TextAlign.center,
            ),
          ),
          24.sizeBoxH,
          Padding(
            padding: EdgeInsets.symmetric(horizontal: 18),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                Container(
                  height: 38,
                  width: 100,
                  child: InkWell(
                    onTap: () async {
                      Get.back();
                      jumpToWalletPage();
                    },
                    child: Container(
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        color: Colors.white.withOpacity(.1),
                        borderRadius: BorderRadius.circular(22),
                      ),
                      child: Text(
                        '会员中心',
                        style: const TextStyle(
                          fontSize: 14,
                          color: Colors.white,
                          fontWeight: FontWeight.w400,
                        ),
                      ),
                    ),
                  ),
                ),
                Container(
                  height: 38,
                  width: 130,
                  child: InkWell(
                    onTap: () async {
                      Get.back();
                      Get.to(() => PreSalePage());
                    },
                    child: Container(
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(22),
                        color: AppColors.primaryHighColor,
                      ),
                      child: Text(
                        '前往活动',
                        style: const TextStyle(
                          fontSize: 14,
                          color: Colors.white,
                          fontWeight: FontWeight.w500,
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
          27.sizeBoxH,
        ],
      ),
    );
  }

  _buildNormalContent() {
    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 32),
      padding: EdgeInsets.fromLTRB(24, 32, 24, 24),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(12),
        color: Color(0xff030F18),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Text(
            "温馨提示",
            style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500, color: Color(0xE5FFFFFF)),
          ),
          12.sizeBoxH,
          Container(
            height: 0.5,
            color: Colors.white.withOpacity(0.1),
          ),
          12.sizeBoxH,
          Text(
            '本内容需要开通VIP会员\n开通会员 即可解锁查看完整版',
            style: TextStyle(fontSize: 16, height: 2.0, color: Color(0x73FFFFFF)),
            textAlign: TextAlign.center,
          ),
          24.sizeBoxH,
          InkWell(
            onTap: () async {
              Get.back();
              jumpToWalletPage();
            },
            child: Container(
              height: 40,
              alignment: Alignment.center,
              decoration: BoxDecoration(
                color: Color(0xffE1351F),
                borderRadius: BorderRadius.circular(3),
              ),
              child: Text(
                '立即开通',
                style: const TextStyle(
                  fontSize: 16,
                  color: Colors.white,
                  fontWeight: FontWeight.w500,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
